import axios from "./index";

//const baseUrl = "http://172.17.2.250:8080"//后端地址

//添加用户提交
// 个人用户请求
export function addPersonalUser(user) {
  return axios({
    url:  "/user/addPersonalUser",//接口地址
    method:"POST",
    data: {
      ...user
    }
  });
}
// 企业用户请求
export function addCompanyUser(user) {
  return axios({
    url:  "/user/addCompanyUser",//接口地址
    method:"POST",
    data: {
      ...user
    }
  });
}

//查询姓名
// export function getByName(user) {
//   return axios({
//     url:  "/user/getByName",//接口地址
//     method:"GET",
//     data: {
//       ...user
//     }
//   });
// }
//查询手机号
// export function getByPhone(user) {
//   return axios({
//     url:  "/user/getByPhone",//接口地址
//     method:"GET",
//     data: {
//       ...user
//     }
//   });
// }

//获取借款用户数据表
export function getLoanUserFrom(page, limit,requerment = {}) {
  return axios({
    url:  "/user/selectAll",//接口地址
    method:"POST",
    params: {
      page,
      size: limit
    },
    data: requerment,
  });
}

//获取投资用户数据表
export function getLoanUserFrom1(page, limit,requerment = {}) {
  return axios({
    url:  "/user/selectWhole",//接口地址
    method:"POST",
    params: {
      page,
      size: limit
    },
    data: requerment,
  });
}

//获取用户详情并修改资料
export function getUserDetails(id) {
  return axios({
    url:  "/user/selectById",//接口地址
    method:"POST",
    params: {
      id
    }
  });
}
//投资用户保存修改
export function updateInvestUserById(id,user) {
  return axios({
    url:  "/user/updateInvestUserById",//接口地址
    method:"POST",
    params:{
      id,
    },
    data: user,
  });
}

//借款 企业用户保存修改
export function submitCompanyInfo(id, info) {
  return axios({
    method: "POST",
    url:  "/user/updateCompanylLendingUserById",
    params: {
      id
    },
    data: info
  });
}
//借款 个人用户保存修改
export function submitPersonalInfo(id, info) {
  return axios({
    method: "POST",
    url:  "/user/updatePersonalLendingUserById",
    params: {
      id
    },
    data: info
  });
}